﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Content;

namespace Pazinga
{
    public class Fighter:WarObject
    {

        //movement acceleration
        private float Acceleration
        {get;set;}

        private int missleCount;

        /// <summary>
        /// Gets and Sets Missle Count
        /// </summary>
        public int MissleCount 
        {
            get { return missleCount; }
            set { missleCount = value; }
        }

        public int Width { set; get;}

        public int Height { set; get; }

        public Rectangle Area 
        {
            get { return new Rectangle((int)X, (int)Y, Width, Height); }
        }

        //Fighter missle type 
        public Missle MissleType
        { get; set; }

        /// <summary>
        /// create new fighter
        /// </summary>
        /// <param name="Accelerate"></param>
        public Fighter(float Accelerate,int w,int h)
        {
            Height = h;
            Width = w;

            missleCount = 3;

            //set acceleration
            Acceleration = Accelerate;

            //set fighter X position
            X = 850;
            
            //get now time miliseconds
            var mili = DateTime.Now.Millisecond;

            //set fighter hight
            Y = new Random(mili).Next(50, 150);

            //wait mili
            while (DateTime.Now.Millisecond == mili) ;

            //check if fighter acceleration is set to move reversed 
            if (Accelerate < 0)
                X = -50;

            MissleType = Missle.M1;

            alive = true;

        }

        /// <summary>
        /// Update the fighter
        /// </summary>
        public void update()
        
        {
      

            //accelerate Fighter
            X-=Acceleration;

            if (x < 0)
            {
                missleCount = 1;
            }
        }

        public void DrawFighter(SpriteBatch sp, Texture2D Tex)
        {
            sp.Draw(Tex, Position, Color.White);
        }
        
    }
}
